/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package nxtmodel2.impl;

import nxtmodel2.Gear;
import nxtmodel2.Motor;
import nxtmodel2.Nxtmodel2Package;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Gear</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link nxtmodel2.impl.GearImpl#getMotor1 <em>Motor1</em>}</li>
 *   <li>{@link nxtmodel2.impl.GearImpl#getMotor2 <em>Motor2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class GearImpl extends PartImpl implements Gear {
	/**
	 * The cached value of the '{@link #getMotor1() <em>Motor1</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMotor1()
	 * @generated
	 * @ordered
	 */
	protected Motor motor1;

	/**
	 * The cached value of the '{@link #getMotor2() <em>Motor2</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMotor2()
	 * @generated
	 * @ordered
	 */
	protected Motor motor2;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GearImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Nxtmodel2Package.Literals.GEAR;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Motor getMotor1() {
		if (motor1 != null && motor1.eIsProxy()) {
			InternalEObject oldMotor1 = (InternalEObject)motor1;
			motor1 = (Motor)eResolveProxy(oldMotor1);
			if (motor1 != oldMotor1) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Nxtmodel2Package.GEAR__MOTOR1, oldMotor1, motor1));
			}
		}
		return motor1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Motor basicGetMotor1() {
		return motor1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMotor1(Motor newMotor1) {
		Motor oldMotor1 = motor1;
		motor1 = newMotor1;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Nxtmodel2Package.GEAR__MOTOR1, oldMotor1, motor1));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Motor getMotor2() {
		if (motor2 != null && motor2.eIsProxy()) {
			InternalEObject oldMotor2 = (InternalEObject)motor2;
			motor2 = (Motor)eResolveProxy(oldMotor2);
			if (motor2 != oldMotor2) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Nxtmodel2Package.GEAR__MOTOR2, oldMotor2, motor2));
			}
		}
		return motor2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Motor basicGetMotor2() {
		return motor2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMotor2(Motor newMotor2) {
		Motor oldMotor2 = motor2;
		motor2 = newMotor2;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Nxtmodel2Package.GEAR__MOTOR2, oldMotor2, motor2));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Nxtmodel2Package.GEAR__MOTOR1:
				if (resolve) return getMotor1();
				return basicGetMotor1();
			case Nxtmodel2Package.GEAR__MOTOR2:
				if (resolve) return getMotor2();
				return basicGetMotor2();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Nxtmodel2Package.GEAR__MOTOR1:
				setMotor1((Motor)newValue);
				return;
			case Nxtmodel2Package.GEAR__MOTOR2:
				setMotor2((Motor)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Nxtmodel2Package.GEAR__MOTOR1:
				setMotor1((Motor)null);
				return;
			case Nxtmodel2Package.GEAR__MOTOR2:
				setMotor2((Motor)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Nxtmodel2Package.GEAR__MOTOR1:
				return motor1 != null;
			case Nxtmodel2Package.GEAR__MOTOR2:
				return motor2 != null;
		}
		return super.eIsSet(featureID);
	}

} //GearImpl
